package com.tanhua.app.config;

import com.tanhua.app.intercept.TokenIntercept;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    //配置拦截器


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new TokenIntercept()) //创建一个Token的拦截器
                .addPathPatterns("/**") //设置拦截的路径（所有）
                .excludePathPatterns("/user/login","/user/loginVerification"); //设置需要直接放行的路径
    }
}
